﻿using Abp.AspNetCore.Mvc.Controllers;
using Batman.Jianbei.Forum.Controllers.Users.Input;
using Batman.Jianbei.Forum.Services.Users;
using Microsoft.AspNetCore.Mvc;
using System.Collections.Generic;
using System.Threading.Tasks;
using Abp.Application.Services.Dto;
using Batman.Jianbei.Forum.Controllers.Users.Filters;

namespace Batman.Jianbei.Forum.Controllers.Users
{
    public class SuperAdminController : AbpController
    {
        public SuperAdminService SuperAdminService { get; set; }

        /// <summary>
        /// 管理员创建用户
        /// </summary>
        /// <returns></returns>
        public async Task<IActionResult> CreateUser(List<UserCreateDto> model)
        {
            var result = await SuperAdminService.CreateUser(model);
            return Json(result);
        }

        /// <summary>
        /// 获取用户分页
        /// </summary>
        /// <param name="page"></param>
        /// <param name="filter"></param>
        /// <returns></returns>
        public async Task<IActionResult> GetUsers(PagedResultRequestDto page, UserFilter filter)
        {
            var result = await SuperAdminService.GetUsers(page, filter);

            return Json(result);
        }
    }
}
